Skip to content

Conversation

jnoordsij
Copy link
Contributor

When using (very) long labels on buttons, they will overflow rather than wrap or cut off the text. It seems that in 5d964ad effort has been made to truncate labels in such cases, however I still experience some issues with longer labels on buttons without explicit width.

The simplest fix I could manage to find was adding a simple max-width: 100% to the button, to ensure it wraps by default. If there's a more subtle way to fix this, I'm all ears!

Demonstrating example:

<!DOCTYPE html>
<html>
<head>
  <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
  <script type="importmap">
  {
    "imports": {
      "@material/web/": "https://esm.run/@material/web/"
    }
  }
  </script>
  <script type="module">
  import '@material/web/all.js';
  import {styles as typescaleStyles} from '@material/web/typography/md-typescale-styles.js';

  document.adoptedStyleSheets.push(typescaleStyles.styleSheet);
  </script>
</head>
<body>
  <p><md-filled-button>Some very long text on a button that will not fit on small screen sizes</md-text-button></p>
  <p><md-filled-button style="max-width: 100%;">Some very long text on a button that will not fit on small screen sizes</md-text-button></p>
  <style>
  md-text-button {
    font-size: 24px;
  }
  </style>
</body>
</html>

{646DADA2-140B-40C2-8819-B537C79324F8}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant